<template>
    <transition name="slide">
        <div class="modal" v-show="showModal" style="display: block;">
            <!-- //遮罩层 -->
            <div class="mask"></div>
            <!-- //弹框 -->
            <div class="modal-dialog">
                <div class="modal-header">
                    <!-- //标题 -->
                    <span>{{title}}</span>
                    <!-- //关闭 -->
                    <a href="javascript:;" class="icon-close" v-on:click="$emit('cancel')"></a>
                </div>
                <div class="modal-body">
                    <!-- //插槽 -->
                    <slot name="body"></slot>
                </div>
                <div class="modal-footer">
                    <!-- //按钮 -->
                    <a href="javascript:;" class="btn" v-if="btnType==1" v-on:click="$emit('submit')">{{sureText}}</a>
                    <a href="javascript:;" class="btn" v-if="btnType==2" v-on:click="$emit('cancel')">{{cancelText}}</a>
                    <div class="btn-group" v-if="btnType==3">
                        <a href="javascript:;" class="btn" v-on:click="$emit('submit')">{{sureText}}</a>
                        <a href="javascript:;" class="btn btn-default" v-on:click="$emit('cancel')">{{cancelText}}</a>
                    </div>
                </div>
            </div>
        </div>
    </transition>
    
</template>
<script>
export default {
    name:'modal',
    //指定传过来的参数
    props:{
        //弹框类型：小small、中middle、大large、表单from
        modalType:{
            type:String,
            default:'from'
        },
        //弹框标题
        title:String,
        //按钮类型：1：只有确定按钮、2：只有取消按钮、3：确定取消都有
        btnType:String,
        sureText:{
            type:String,
            default:'确定'
        },
        cancelText:{
            type:String,
            default:'取消'
        },
        //弹框要不要展示出来
        showModal:Boolean
    }
}
</script>
<style lang="scss">
  @import './../assets/scss/mixin.scss';
  @import './../assets/scss/config.scss';
  @import './../assets/scss/modal.scss';
</style>